﻿create procedure [dbo].[usp_ExceptionDelete]
	@ExceptionId int
	-- @AppDomainId required to avoid entity framework mapping error 2048 (.net framework 3.5 SP1)
	, @AppDomainId int = null
	-- @AssemblyId required to avoid entity framework mapping error 2048 (.net framework 3.5 SP1)
	, @AssemblyId int = null
	-- @MachineId required to avoid entity framework mapping error 2048 (.net framework 3.5 SP1)
	, @MachineId int = null
	-- @IIdentityId required to avoid entity framework mapping error 2048 (.net framework 3.5 SP1)
	, @IIdentityId int = null
	-- @ProcessId required to avoid entity framework mapping error 2048 (.net framework 3.5 SP1)
	, @ProcessId int = null
	-- @TargetSiteId required to avoid entity framework mapping error 2048 (.net framework 3.5 SP1)
	, @TargetSiteId int = null
	-- @ThreadId required to avoid entity framework mapping error 2048 (.net framework 3.5 SP1)
	, @ThreadId int = null
	-- @WorkItemId required to avoid entity framework mapping error 2048 (.net framework 3.5 SP1)
	, @WorkItemId int = null
as

begin try
	begin transaction
	
	delete from [dbo].[Exception] where [ExceptionId] = @ExceptionId
	
	commit transaction
end try

begin catch
	if @@trancount > 0
	begin
		rollback transaction
	end
	execute [dbo].[usp_SqlErrorInsert]
end catch